package solution.T0302_1_News;

import java.util.ArrayList;
import java.util.List;


class User implements Subscriber {
    private String name;
    private final List<String> receivedArticles = new ArrayList<>();
    private final List<NewsChannel> subscribedChannels = new ArrayList<>();

    public User(String name) {
        this.name = name;
    }

    @Override
    public void update(String channelName, String articleTitle) {
        receivedArticles.add(articleTitle);
    }

    @Override
    public void readArticle(NewsPlatform platform, String articleTitle) {
        Article article = platform.getArticle(articleTitle);
    }

    public void viewArticleList(NewsPlatform platform) {
        List<String> titles = platform.getAllArticleTitles();
    }

    public void subscribeToChannel(NewsChannel channel) {
        channel.subscribe(this);
        subscribedChannels.add(channel);
    }

    public void unsubscribeFromChannel(NewsChannel channel) {
        channel.unsubscribe(this);
        subscribedChannels.remove(channel);
    }
}
